<? 

	$title="Delete member"; 
	$pageid="2";
	$accessid="a00";

	require("required/dbconnect.php"); 
	require("required/function.php");
	
	
	
	
	if(isset($_POST['btnsubmit']))
	{
		$id=$_POST['hidid'];
		$get_info=mysql_query("select * from os_slider where id=$id");
		$m=mysql_fetch_array($get_info,MYSQL_ASSOC);
		
			$product_pic="../slider/slider_".$m['id'].".gif";
			
		if(file_exists($product_pic))
		{	
			unlink($product_pic);
		}
		
		mysql_query("delete from os_slider where id=$id");
		header("Location:slider_viewall.php");
			
	}
	else
	{
		require("required/header.php");
		$id=$_GET['id'];
		
		$get_file=mysql_query("select * from os_slider where id=$id");
		
		if(mysql_num_rows($get_file)==0)
		{
			die("no file found!");
		}
		
		$a=mysql_fetch_array($get_file,MYSQL_ASSOC);
		
		if($a["pic"]=="")
		{
			$pic="empty";
			$piclink="noimage.jpg";
			$fix="";
		}
		else
		{
			$piclink="slider_".$a['id'].".gif";
			$width=$a['width'];
			$height=$a['height'];
			if($width>=700 or $height>=280)
			{
				if($width-$height>0)
				{
					$fix="width=700";
				}
				else
				{
					$fix="height=280";
				}						
			}
			else
			{
				$fix="width=$width";
			}
		}					
	
	
?>
<table width="100%">
  
    <td align="left" valign="top"><table width="80%" cellpadding="2" cellspacing="1">
       <tr>
			<td class="title">
				Delete Slide Image
			</td>
		</tr>
        <form action="<?= $_SERVER['PHP_SELF'] ?>" method="post">
          <tr>
            <td>Confirm to delete
              <?= $a['slide_name'] ?>
              ?</td>
          </tr>
          <tr>
            <td><img src="../slider/<?= $piclink ?>"></td>
          </tr>
          <input type="hidden" value="<?= $id ?>" name="hidid">
          <tr>
            <td><input type="submit" value="Yes" class="button" name="btnsubmit">
              <input type="button" value="No" class="button" onClick="history.go(-1)"></td>
          </tr>
        </form>
      </table></td>
</table>
<? }require("required/footer.php"); ?>
